<template>
    <div>
        兄弟组件1
        {{ userInfo }}
        <button @click="sendToBrother2">传递信息到兄弟组件2</button>
    </div>
</template>

<script>
import bus from "@/utils/eventBus";
export default {
    components: {},
    props: {},
    data() {
        return {};
    },
    computed: {
        userInfo() {
            return this.$store.state.myInfo.userInfo.username
                ? this.$store.state.myInfo.userInfo
                : JSON.parse(sessionStorage.getItem("userInfo"));
        }
    },
    methods: {
        sendToBrother2() {
            bus.$emit("sendBrotherMessage", { data: "我是兄弟1组件的信息" });
        }
    },
    created() {},
    mounted() {}
};
</script>
<style scoped></style>
